﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YJKArchMethodLibrary.Utils;
using YJKElementFinish.WallInsulationLayer.Controllers;
using YJKView;

namespace YJKElementFinish.WallInsulationLayer
{
	[Regeneration(RegenerationOption.Manual)]
	[Transaction(TransactionMode.Manual)]
	public class CmdAddInsulationLayer : IExternalCommand
	{
		public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elems)
		{
			CmdViewType types = CmdViewType.FloorPlan;
			if (SwitchView.SetUsableView(types, cmdData) != Autodesk.Revit.UI.Result.Succeeded)
			{
				return Autodesk.Revit.UI.Result.Failed;
			}
			HideWarningAndErroringKit @object = new HideWarningAndErroringKit(new List<string>
			{
				"create wall",
				"join wall",
				"join walls with insulation layer",
				"modify wall height"
			}, HideWarningAndErroringKit.HideKitEnum.HideErroringAndWarning);
			cmdData.Application.Application.FailuresProcessing += @object.OnFailuresProcessing;
			AddInsulationLayerController addInsulationLayerController = new AddInsulationLayerController(cmdData);
			return addInsulationLayerController.CreateInsulationLayer();
		}
	}
}
